package panics

import (
	"fmt"
	"log/slog"
	"nprobe/utils/traces"
)

func Recover(name string) {
	if r := recover(); r != nil {
		stackInfo := traces.Stack(2)
		slog.Error(fmt.Sprintf("%s Recovered from panic. err: %+v, stack traces: %s", name, r, stackInfo))
	}
}
